"""ElevatorAdmin URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin


V1_URL_PREFIX = 'api/v1/'
# V2_URL_PREFIX = 'TejianSupervision/api/'
V2_URL_PREFIX = 'wx-elevator/'
from django.views.static import serve


def v1_url(regex, view, kwargs=None, name=None):
    url_prefix = r'^' + V1_URL_PREFIX
    regex = url_prefix + regex
    return url(regex, view, kwargs, name)


def v2_url(regex, view, kwargs=None, name=None):
    url_prefix = r'^' + V2_URL_PREFIX
    regex = url_prefix + regex
    return url(regex, view, kwargs, name)


urlpatterns = [
    # url(r'^admin/', admin.site.urls),
    v1_url(r'user/', include('users.urls')),
    v1_url(r'utils/', include('utils.urls')),
    v1_url(r'basic/', include('basic.urls')),
    v1_url(r'maintain/', include('maintenance.urls')),
    v1_url(r'rescue/', include('rescue.urls')),
    v1_url(r'manu/', include('manufacturer.urls_status')),
    v2_url(r'', include('manufacturer.urls')),
    url(r'image/(?P<path>.*)$',  serve, {'document_root': '/home/dell/projects/elevator/media'}),
    v1_url(r'sta/', include('statistics.urls')),
    url(r"", include('manufacturer.city_center_urls')),
    v1_url(r'res/', include('resources.urls')),
]

